package com.inquire.controller;

import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CookieValue;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.inquire.entity.Children;
import com.inquire.entity.InquireCollector;
import com.inquire.entity.InquireOrgTerminal;
import com.inquire.entity.InquireTerminal;
import com.inquire.service.FileInquireService;
import com.utils.JsonResult;

/**
 * @Title: FileInquireController.java
 * @Package com.inquire.controller
 * @author 孙梦楠
 * @date 2017年8月8日 上午8:27:26
 * @version V1.0.0
 */
@RestController
@RequestMapping(value = "/inquire/fileinquire")
public class FileInquireController {
	
	
	private static final Logger log = LoggerFactory.getLogger(FileInquireController.class);


	@Autowired
	private FileInquireService fileinquireservice;

	// 单个集中器信息
	@RequestMapping(value = "/inquireterminal", method = RequestMethod.POST)
	public JsonResult<InquireTerminal> listinquireterminal(@RequestBody InquireTerminal inquireterminal,
			@CookieValue(value = "languagecookie", required = false) String languagecookie) {

		Integer terminalid = inquireterminal.getTerminalid();
		return fileinquireservice.listinquireterminal(terminalid,languagecookie);
	}

	// 单个采集器信息
	@RequestMapping(value = "/inquirecollector", method = RequestMethod.POST)
	public JsonResult<InquireCollector> listinquirecollecor(@RequestBody InquireCollector inquirecollector,
			@CookieValue(value = "languagecookie", required = false) String languagecookie) {

		Integer collectorid = inquirecollector.getCollectorid();
		return fileinquireservice.listinquirecollector(collectorid,languagecookie);
	}

	// 设备组织架构
	@RequestMapping(value = "/inquireorg", method = RequestMethod.GET)
	public JsonResult<Children> listinquireorg(
			@CookieValue(value = "opeorgcookie", required = false) String opeorgcookie,
			@CookieValue(value = "opetypecookie", required = false) String opetypecookie) {
		
		log.info("opeorgcookie  "+opeorgcookie);

		return fileinquireservice.listinquireorg(opeorgcookie,opetypecookie);
	}

}
